package com.whmall.service.crm.module.companyuser.impl;

import com.whmall.component.common.ObjectConverter;
import com.whmall.service.crm.entity.dto.companyuser.CreateOrUpdateCompanyUserReqDTO;
import com.whmall.service.crm.module.companyuser.entity.CompanyUserInformationDO;
import org.springframework.stereotype.Component;

/**
 * CreateOrUpdateCompanyUserReqDTO -> CompanyUserInformationDO 转换器
 *
 * @author alex
 * @since 2020/7/31
 */
@Component
public class CoU2CompanyUserInformationConverter
        implements ObjectConverter<CreateOrUpdateCompanyUserReqDTO, CompanyUserInformationDO> {
    @Override
    public CompanyUserInformationDO fillProperties(CreateOrUpdateCompanyUserReqDTO source, CompanyUserInformationDO dest) {
        if (null == dest) {
            dest = new CompanyUserInformationDO();
        }

        dest.setAvatar(source.getAvatar());
        dest.setNotifyBitmap(source.getNotifyBitmap());
        dest.setPurchaserComment(source.getPurchaserComment());
        dest.setSupplierContact(source.getSupplierContact());
        dest.setPosition(source.getPosition());
        dest.setDepartment(source.getDepartment());
        dest.setPreference(source.getPreference());
        dest.setIsAutoQuotation(source.getIsAutoQuotation());
        dest.setInvoiceEmail(source.getInvoiceEmail());

        return dest;
    }
}
